WordPress [img] tags

Posted by Lokheed on Stack Overflow See other posts from Stack Overflow or by Lokheed
Published on 2011-01-18T02:42:05Z Indexed on 2011/01/18 2:53 UTC
Read the original article Hit count: 166

Filed under:
|

Hey guys, I'm trying to allow that standard BB [img] [/img] tags on my WordPress blog. I got this snippet from the net, but it only works on lower case [img] tags. I'd like it to apply to both [img] and [IMG]. As you can tell, I'm totally not a coder.

function embed_images($content) {
 $content = preg_replace('/\[img=?\]*(.*?)(\[\/img)?\]/e', '"<img src=\"$1\" alt=\"" . basename("$1") . "\" />"', $content);
 return $content;
}

add_filter('comment_text', 'embed_images');

I know '||' is 'or' but don't know enough coding to make the changes. Any help is greatly appreciated. Thanks.

© Stack Overflow or respective owner

Related posts about php

Related posts about Wordpress